<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>账号激活</title>
    <script>
        function getUrlParam(name) {
            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); //构造一个含有目标参数的正则表达式对象
            var r = window.location.search.substr(1).match(reg);  //匹配目标参数
            if (r != null) return unescape(r[2]);
            return null; //返回参数值
        }
    </script>
    <script type="text/javascript" src="/static/js/jquery-1.12.4.js"></script>
                
    <script type="text/javascript" src="./static/js/jquery-1.12.4.js"></script>
    <script type="text/javascript" src="./static/js/my.js"></script>
</head>
<body>
    <p>账号激活中。。。。。。。</p>
    <script>
        var user_id = getUrlParam('user_id');
        console.log(user_id);
        activate(user_id);
        function activate(user_id) {
            $.ajax(
                {
                    url:'/api/user/register?user_id='+user_id,
                    type:'GET',
                    // data:JSON.stringify(dataj),
                    xhrFields: {
                        withCredentials: true
                    },
                    success:function(obj) {
                        if(obj.code == 20){
                            alert("激活成功，点击登录咯");
                            setTimeout("window.location.href='/login.html'",1000);
                        }
                        else {
                            alert(obj.msg);
                            // $('#error_msg').text(obj.msg)
                        }
                    },
                    error:function(obj) {
                        alert('未知错误');
                    }
                }
            )
        }
    </script>
</body>
</html>